<include file="public/head" />
<!-- 微信自定义接口 -->

</head>
<body>
<div class="am-modal am-modal-alert" tabindex="-1" id="fq_alert">
  <div class="am-modal-dialog">
    <div class="am-modal-hd" id="fq_alert_title"></div>
    <div class="am-modal-bd" id="fq_alert_info">
    </div>
    <div class="am-modal-footer">
      <span class="am-modal-btn">确定</span>
    </div>
  </div>
</div>

<div class="am-modal am-modal-confirm" tabindex="-1" id="fq_confirm">
  <div class="am-modal-dialog">
    <div class="am-modal-hd" id="fq_confirm_title"></div>
    <div class="am-modal-bd" id="fq_confirm_info"></div>
    <div class="am-modal-footer">
      <span class="am-modal-btn" data-am-modal-confirm="">确定</span>
    </div>
  </div>
</div>

<link rel="stylesheet" href="__STATIC__/itaoke/mobile/css/sign.css">
    <div class="whole">
        <header class="am-margin-bottom-lg am-cf ">
            <ul class="am-avg-sm-3 am-padding-vertical-lg ">
                <li>
                    <div class="am-total1 am-margin-left-sm am-padding-left-xs">
                        <span>已签到天数</span>
                        <br>
                        <span class="count_days">{$sign.sign_count}</span>
                    </div>
                    <div class="am-total1 am-margin-left-sm am-margin-top-sm am-padding-left-xs">
                        <span>已获得积分</span>
                        <br>
                        <span class="count_sore">{$sign.score}</span>
                    </div>
                    <div class="am-total1 am-margin-left-sm am-margin-top-sm  am-padding-left-xs">
                        <span>连续签到天数</span>
                        <br>
                        <span class="checkindays">{$sign.sign_ucount}</span>
                    </div>
                </li>

                <li class="am-text-center  am-vertical-align-middle ">
                    <div class="am-head-portrait am-margin-top-xl  am-vertical-align-middle">
                        <img src="{:avatar($info['id'], 200)}" class="am-center ">
                        <div class=" am-margin-top-sm am-vertical-align-left am-center">
                        <php>$username= $info['wxnickname']!='' ? $info['wxnickname'] : $info['username']</php>
                            <span>{$username}</span>
                        </div>
                    </div>
                </li>
                <li class="am-text-right am-padding-top-lg">
                    <div class="am-padding-top-sm am-margin-right-sm"><a class="am-register">签到规则</a></div>
                    <div class="am-padding-vertical-sm am-margin-right-sm "><a class="am-point" href="{:U('Sign/record')}">签到记录</a></div>
                </li>
            </ul>
        </header>
        <div style="" class="am-button am-text-align-bottom am-margin-right-lg am-fr am-padding-horizontal-sm am-padding-vertical-sm am-text-center sign_button">
            <if condition="$sign.last_date eq strtotime(date('Y-m-d'))"> <else/><span class="am-icon-edit am-icon-xs am-check" id="sign_result"></span></if>
            
            <div class="am-padding-top-xs am-check Is_sign" style=""><if condition="$sign.last_date eq strtotime(date('Y-m-d'))">已签到<else/>签到</if></div>
        </div>

        <div class="ranking am-margin-horizontal-sm">
            <ul class="am-avg-sm-3 ">
                <li>
                    <button type="button" value="1" class="count_ranking rank_butt am-butt-first am-padding-vertical-sm">总排行</button>
                </li>
                <li>
                    <button type="button" value="2" class="continuous_ranking rank_butt am-padding-vertical-sm am-butt">连续签到排行</button>
                </li>
                <li>
                    <button type="button" value="3" class="score_ranking am-butt-last rank_butt am-padding-vertical-sm">签到积分排行</button>
                </li>
            </ul>
        </div>
        <div class="am-tab am-padding-vertical">
            <ul class="  am-avg-sm-3 am-text-center am-padding-xs ">
                <li>排行</li>
                <li>用户</li>
                <li class="show_data">总签到天数</li>

            </ul>
	<div class="ranking_list count_days_limit" style="display:block;margin-bottom:5rem;">
	<volist name="allrank" id="vo">
		<ul class=" am-avg-sm-3 am-margin-top-sm">
			<li class=" am-midd am-vertical-align-middle am-text-center">{$i}</li>
			<li>
			    <ul class=" am-avg-sm-2">
				<li class=" am-text-right am-padding-right-xs">
				    <img src="{:avatar($vo['uid'], 200)}" class=" am-round am-img"></li>
				<li class="am-midd am-vertical-align-middle am-text-left">{:getUsername($vo['uid'])}</li>
			    </ul>
			</li>
			<li class="am-midd am-vertical-align-middle am-text-center"> {$vo.sign_count}</li>
		    </ul>
	</volist>
	</div> 
    
    <!--连续签到-->
    <div class="ranking_list continuous_sign" style="margin-bottom:5rem;">
 	<volist name="urank" id="vo">
		<ul class=" am-avg-sm-3 am-margin-top-sm">
			<li class=" am-midd am-vertical-align-middle am-text-center">{$i}</li>
			<li>
			    <ul class=" am-avg-sm-2">
				<li class=" am-text-right am-padding-right-xs">
				    <img src="{:avatar($vo['uid'], 200)}" class=" am-round am-img"></li>
				<li class="am-midd am-vertical-align-middle am-text-left">{:getUsername($vo['uid'])}</li>
			    </ul>
			</li>
			<li class="am-midd am-vertical-align-middle am-text-center"> {$vo.sign_ucount}</li>
		    </ul>
	</volist>
	 </div>

    <!--签到积分排行-->

    <div class="ranking_list integral_ranking" style="margin-bottom:5rem;">
 	<volist name="srank" id="vo">
		<ul class=" am-avg-sm-3 am-margin-top-sm">
			<li class=" am-midd am-vertical-align-middle am-text-center">{$i}</li>
			<li>
			    <ul class=" am-avg-sm-2">
				<li class=" am-text-right am-padding-right-xs">
				    <img src="{:avatar($vo['uid'], 200)}" class=" am-round am-img"></li>
				<li class="am-midd am-vertical-align-middle am-text-left">{:getUsername($vo['uid'])}</li>
			    </ul>
			</li>
			<li class="am-midd am-vertical-align-middle am-text-center"> {$vo.score}</li>
		    </ul>
	</volist>
	 </div>

        </div>
    </div>

<include file="public/foot" />
    <div class="prompt am-vertical-align am-text-center" style="">
        <div class="prompt-content  am-vertical-align-middle am-text-middle am-padding-top-lg " style="">
            <span id="warning">恭喜你签到成功！<br>明天再来喔。</span>
            <br>
            <a class="confirm am-margin-top am-margin-bottom-sm am-padding-vertical-xs am-padding-horizontal-lg ok">好的</a>
        </div>
		 <div class="register-rule  am-vertical-align-middle am-text-center am-padding-top am-padding-bottom am-padding-horizontal-lg am-margin-horizontal-sm">       
		<textarea id="rules" readonly="">每天签到即可奖励积分！
每天有{:C('itk_score_rule.sign_nums')}次签到机会！

积分获取：签到奖励：{:C('itk_score_rule.sign')}积分

连续签到{:C('itk_score_rule.sign_day')}天，额外奖励{:C('itk_score_rule.sign_add')}积分

注意事项:
    如果连续签到中断的话，
    连续签到天数将重置为1；
    同一时段不能连续签到1次以上	
		</textarea>
          <br>
            <a class="confirm am-margin-top am-margin-bottom-sm am-padding-vertical-xs am-padding-horizontal-lg">明白了</a>
        </div>
    </div>
<script>
       $('.count_ranking').click(function(){
            $('.ranking_list').hide();
            $('.count_days_limit').show();
            $('.rank_butt').css({'background':'none','color':'#8f8f8f'});
            $(this).css({'background':'#f54d23','color':'white','height':'101%'});
            $('.show_data').text('总签到天数');
       });
	
       $('.continuous_ranking').click(function(){
             $('.ranking_list').hide();
             $('.continuous_sign').show();
             $('.rank_butt').css({'background':'none','color':'#8f8f8f'});
             $(this).css({'background':'#f54d23','color':'white','height':'101%'});
             $('.show_data').text('连续签到天数');

       });

       $('.score_ranking').click(function(){
            $('.ranking_list').hide();
            $('.integral_ranking').show();
            $('.rank_butt').css({'background':'none','color':'#8f8f8f'});
            $(this).css({'background':'#f54d23','color':'white','height':'101%'});
            $('.show_data').text('签到总积分');
       });
	
	 //签到
         $('.sign_button').one('click',function(){
             image_src = "__STATIC__/itaoke/mobile/images/sign/signed.png";
             $('.am-button').css('background-image','url('+image_src+')');
            $.ajax({
                data:{'sign':1},
                type:'get',
                url:"{:U('Sign/ajax_sign')}",
                success:function(data){
                    if(data.data.status==0){
                        $('.count_days').html(data.count_days);
                        $('.count_sore').html(data.sign_sore);
						$('.checkindays').html(data.continuous_days);
                        $('.Is_sign').css('font-size','1.2rem'); 
                        $('.Is_sign').css('color','#fff');
                        $('.Is_sign').text("已签到");
                        $('#sign_result').toggleClass('am-icon-edit',false);
                        $('.Is_sign').after('<div style="margin-top:0.14rem;color:#fff;font-size:1.2rem">+'+data.add_sore+'</div>');
                        $('.am-button').css('padding','0');
                        $('.am-button').css('line-hieght','1rem');
                        $('.am-button').css('padding-top','1rem');
                        $(".prompt").css("display", "block");
						$(".prompt-content").css("display", "inline-block");
                        $('#warning').html(data.data.msg);
                    }
					else{
					    $(".prompt").css("display", "block");
						$(".prompt-content").css("display", "inline-block");
					    $('#warning').html(data.data.msg);
					}

                }
            })

         })
			
		//弹框关闭按钮
        $(".confirm").click(function(){
            $(".prompt").css("display", "none");
        })
		
		$(".am-register").click(function(){
            $(".prompt").css("display", "block");
            $(".register-rule").css("display", "inline-block");
            $(".prompt-content").css("display", "none");
        })
		
</script>
</body> 
</html>